﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using Seesmic.Sdp.Utils;
using System.Windows.Controls.Primitives;
using PTiRouZ.Net.SilverLight.Api.HelloTipi;
using System.Collections.ObjectModel;

namespace Seesmic.HelloTipi.Controls
{
    public partial class PhotosTemplate : UserControl
    {
        public PhotosTemplate()
        {
            InitializeComponent();

            this.Loaded += new RoutedEventHandler(PhotosTemplate_Loaded);

        }

        void PhotosTemplate_Loaded(object sender, RoutedEventArgs e)
        {
            if (lbPhotos.Items.Count > 0)
                lbPhotos.SelectedItem = lbPhotos.Items.First();
        }

        private void lbPhotos_LayoutUpdated(object sender, EventArgs e)
        {
            if (lbPhotos.SelectedItem == null)
            {
                if (lbPhotos.Items.Count > 0)
                    lbPhotos.SelectedItem = lbPhotos.Items.First();
            }
        }
    }
}
